class Solution(object):
    def decode(self, encoded, first):
        n = len(encoded)
        out = [0] * (n + 1)
        out[0] = first
        for i in range(n):
            out[i + 1] = out[i] ^ encoded[i]
        return out